/**
 * @file: core.c
 * @brief: 中间层
 * @author: liaowx
 * @date: 2019.08.03
 */
#include <stdio.h>
#include <string.h>

#include "app.h"
#include "core.h"
#include "file_copy.h"

struct core *mode_ctl(int mode, struct core *core)
{
    struct core *ret_core;
    switch (mode) {
        case COPY:
            core->copy_ctl(core->file_name);
            break;
        case GET_DEV_CTL:
            ret_core = get_dev();
            return ret_core;
    }

    return NULL;
}

int match(char *app_arg, struct core *core)
{
    int count = 0;

    while (count < CMD_NUM) {
        if (0 == strcmp(app_arg, core->arg[count])) {
            return count;
        }
        count++;
    }

    return -1;
}